Skip to content

fix(hub-ui): resolve dock iframe paths against the hub in cross-origin embeds - #518

Open
webfansplz wants to merge 1 commit into
devframes:mainfrom
webfansplz:fix/iframe-dock-origin
Open

webfansplz wants to merge 1 commit into
devframes:mainfrom
webfansplz:fix/iframe-dock-origin

Conversation

@webfansplz

Copy link
Copy Markdown
Member

Fix the iframe 404 reported in vitejs/devtools#570 by resolving server-registered iframe paths against the hub’s origin when the dock is embedded on another origin.

Verified in Chrome with the page and hub on separate ports. The iframe loads on first open and restores its saved route after refresh.

Copilot AI balanced review requested due to automatic review settings December 2, 2026 09:46
@vercel

vercel Bot commented Dec 2, 2026

Copy link
Copy Markdown

@webfansplz is attempting to deploy a commit to the NuxtLabs Team on Vercel.

A member of the Team first needs to authorize it.

@github-actions

github-actions Bot commented Dec 2, 2026

Copy link
Copy Markdown

👁️‍🗨️ Review this pull request with grouped, summarized diffs at:
👉 https://pulls.review/gh/devframes/devframe/518?from=github-actions[bot]

raw result

💭 analyzed by vercel-ai-gateway/anthropic/claude-sonnet-5
🕰️ 2026-12-02 09:46 UTC
🔗 head c7f9943
🤖 automated by pulls.review

{
  "headSha": "c7f994349869d94ebf65016913048e2bcec074db",
  "result": {
    "overallSummary": "Fixes a 404 when the hub-ui dock is embedded on a different origin than the hub: server-registered iframe docks with relative/root paths are now resolved against the hub's own origin (using `resolveDockUrl`) rather than the embedding page's origin, so the iframe loads correctly on first open and still restores its saved route after refresh. A regression test is added to cover this scenario alongside existing local-dock behavior.",
    "groups": [
      {
        "key": "fix-cross-origin-dock-url",
        "label": "Resolve dock iframe URLs",
        "summary": "When the dock is embedded cross-origin, server-registered iframe paths starting with `/`, `./` or `../` are now resolved against the hub's origin (via `resolveDockUrl`) instead of the embedding page's origin, fixing 404s on first load.",
        "category": "core",
        "filePaths": [
          "packages/hub-ui/src/client/state/context.ts"
        ],
        "lineNotes": [
          {
            "path": "packages/hub-ui/src/client/state/context.ts",
            "side": "additions",
            "line": 58,
            "text": "Cross-origin detection compares the hub's metaBaseUrl origin to the current page origin; only applies when embedded and not a locally-registered client dock.",
            "critical": true
          }
        ]
      },
      {
        "key": "dock-url-tests",
        "label": "Dock route persistence tests",
        "summary": "Adds a regression test covering cross-origin iframe URL resolution, saved-route restoration, and that locally registered docks keep their original (non-resolved) URLs.",
        "category": "tests",
        "filePaths": [
          "packages/hub-ui/src/client/state/context.test.ts"
        ]
      }
    ],
    "schemaVersion": 1,
    "source": "llm",
    "generatedAt": "2026-12-02T09:46:33.030Z",
    "model": "vercel-ai-gateway/anthropic/claude-sonnet-5",
    "locale": "en"
  }
}

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

No active review issues were identified in the cross-origin dock iframe URL fix.

No open issues 🎉

What changed in this PR

Fixes dock iframe URLs in cross-origin embeds so server-registered paths load from the hub rather than the embedding page.

Changes:

  • Resolves /, ./, and ../ iframe paths against the hub, preserving bare paths and locally registered docks.
  • Adds regression coverage for URL resolution, saved-route restoration, and local overrides.
File Description
packages/​hub-ui/​src/​client/​state/​context.ts Resolves server-registered iframe paths in cross-origin embeds.
packages/​hub-ui/​src/​client/​state/​context.test.ts Tests URL resolution, route restoration, and preserved overrides.

Review effort: Balanced

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants